package com.bw.educate.controller;


import com.bw.educate.common.ResponseResult;
import com.bw.educate.entity.EduUser;
import com.bw.educate.entity.SysUser;
import com.bw.educate.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 在线教育-五组
 * @since 2020-08-12
 */
@RestController
@RequestMapping("user")
public class SysUserController {

    @Autowired
    private ISysUserService userService;

    /**
     * @Description: 管理员登录
     * @Author: 王文佳
     * @Date: 2020/8/14 15:24
     * @param user:
     * @return: com.bw.educate.common.ResponseResult
     **/
    @PostMapping("login")
    public ResponseResult login(@RequestBody EduUser user, HttpServletResponse response){

        ResponseResult result = userService.login(user,response);

        return  result;
    }


    @GetMapping("getList")
    public ResponseResult getList(){

        ResponseResult result =ResponseResult.SUCCESS();
        List<SysUser> list = userService.list();
        result.setResult(list);
        result.setMessage("查询成功");

        return  result;
    }



}
